package com.imooc.girl.exception;

import com.imooc.girl.result.ResultEnums;

/**
 * @description:
 * @program: girl
 * @author: Administrator
 * @date: 2019/2/19 23:03
 */
public class GirlException extends RuntimeException {
    private String errorCode;

    /**
     * Constructs a new runtime exception with the specified detail message.
     * The cause is not initialized, and may subsequently be initialized by a
     * call to {@link #initCause}.
     *
     * @param message the detail message. The detail message is saved for
     *                later retrieval by the {@link #getMessage()} method.
     */
    public GirlException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public GirlException(ResultEnums enums) {
        super(enums.getErrorMsg());
        this.errorCode = enums.getErrorCode();
    }

    public String getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(String errorCode) {
        this.errorCode = errorCode;
    }
}
